//package com.example.springboot.RabbitMQ.BasicOperation;
//
//import com.rabbitmq.client.AMQP;
//import com.rabbitmq.client.BuiltinExchangeType;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//
//// Headers头交换机不处理路由键，而是根据消息的headers属性进行匹配。
//// 应用场景：适用于需要根据消息的特定属性进行路由的场景。
//// 绑定规则：在绑定队列和交换机时，可以指定一组键值对；消息的headers中包含这些键值对时，消息会被路由到该队列
//// x-match的两个参数 all any，all（header信息必须全部匹配），any（header信息需要匹配其中一项）
//
//@Component
//public class HeaderDome {
//
//    @Autowired
//    private static BasicOperation basicOperation;
//
//    private static String exchangeName = "exchange_Headers_01";
//    private static String queueName_01 = "queue_Headers_01";
//    private static BuiltinExchangeType builtinExchangeType = BuiltinExchangeType.HEADERS;
//
//    public void builder() throws IOException {
//
//        basicOperation.createExchange(exchangeName,builtinExchangeType,true,false,null);
//
//        basicOperation.createQueue(queueName_01,true,false,false,null);
//
//        Map<String,Object> headersMap = new HashMap<>();
//        headersMap.put("x-match","any");
//        headersMap.put("name","哈哈哈");
//        headersMap.put("sex","女");
//
//        basicOperation.queueBind(queueName_01,exchangeName,"",headersMap);
//
//    }
//
//    public void sendMsg() throws IOException {
//
//        Map<String,Object> headersMap = new HashMap<>();
//
//        headersMap.put("name","哈哈哈");
//        headersMap.put("sex","男");
//
//        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties().builder().headers(headersMap);
//
//
//        basicOperation.sendMsg(exchangeName,"",properties.build(),"any messahe");
//    }
//
//    public void receiveMsg() throws IOException {
//
//        basicOperation.receiveMsg(queueName_01);
//
//    }
//
//
//
//}
